package com.lw.staservice.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lw.commonutil.result.Result;
import com.lw.staservice.client.UcenterClient;
import com.lw.staservice.entity.StatisticsDaily;
import com.lw.staservice.service.StaService;
import org.apache.commons.lang3.RandomUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/admin/staservice/sta")
public class StaController {
    @Autowired
    private StaService staService;


    //统计某一天注册人数
    @PostMapping("/registerCount/{day}")
    public Result registerCount(@PathVariable String day){
        staService.registerCount(day);
        return Result.ok();
    }
    //图表显示，返回两部分数据，日期json数组，数量json数组
    @GetMapping("/showData")
    public Result showData(@RequestParam("type") String type,
                           @RequestParam("begin") String begin,
                           @RequestParam("end") String end){
        Map map = staService.showData(type,begin,end);
        return Result.ok( map );
    }
}
